package com.liuyucheng.concurrent.waitnotify;

public class Consumer implements Runnable {
    private Message message;

    public Consumer(Message message) {
        this.message = message;
    }

    @Override
    public void run() {
        // 持续消费，直到收到"结束"消息
        String msg;
        while (!(msg = message.receive()).equals("结束")) {
            // 处理消息（这里仅打印）
        }
    }
}